home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
4_12.lha
/
4_12
/
4_12b.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-08
|
485b
|
28 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <stream.h>
nt main(int, char**)
short count[0400];
for (int i = 0; i < 0400; i++)
count[i] = 0;
unsigned char c;
long total = 0;
while (cin.get(c))
{
count[c]++;
total++;
}
if (total > 0)
for (i = 0; i < 0400; i++)
cout << i << "\t" << count[i] << "\t" <<
(100.0 * count[i] / total) << "\n";
return 0;